/*  1:   */ package org.intellij.plugins.relaxNG.model.annotation;
/*  2:   */ 
/*  3:   */

import com.intellij.lang.annotation.Annotation;
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.psi.PsiElement;
import com.intellij.util.xml.DomElement;
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder;
import org.jetbrains.annotations.NotNull;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */ 
/* 11:   */ abstract class CommonAnnotationHolder<C>
/* 12:   */ {
/* 13:   */   public static <T extends DomElement> CommonAnnotationHolder<T> create(DomElementAnnotationHolder paramDomElementAnnotationHolder)
/* 14:   */   {
/* 15:29 */     return new DomHolderAdapter(paramDomElementAnnotationHolder);
/* 16:   */   }
/* 17:   */   
/* 18:   */   public static <T extends PsiElement> CommonAnnotationHolder<T> create(AnnotationHolder paramAnnotationHolder)
/* 19:   */   {
/* 20:33 */     return new HolderAdapter(paramAnnotationHolder);
/* 21:   */   }
/* 22:   */   
/* 23:   */   public abstract Annotation createAnnotation(C paramC, @NotNull HighlightSeverity paramHighlightSeverity, String paramString);
/* 24:   */   
/* 25:   */   private static class DomHolderAdapter<T extends DomElement>
/* 26:   */     extends CommonAnnotationHolder<T>
/* 27:   */   {
/* 28:   */     private final DomElementAnnotationHolder a;
/* 29:   */     
/* 30:   */     DomHolderAdapter(DomElementAnnotationHolder paramDomElementAnnotationHolder)
/* 31:   */     {
/* 32:42 */       this.a = paramDomElementAnnotationHolder;
/* 33:   */     }
/* 34:   */     
/* 35:   */     public Annotation createAnnotation(DomElement paramDomElement, @NotNull HighlightSeverity paramHighlightSeverity, String paramString)
/* 36:   */     {
/* 37:46 */       if (paramHighlightSeverity == null) {
/* 38:46 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder$DomHolderAdapter", "createAnnotation" }));
/* 39:   */       }
/* 40:46 */       Annotation localAnnotation = this.a.createAnnotation(paramDomElement, paramHighlightSeverity, paramString);
/* 41:47 */       localAnnotation.setTooltip(paramString);
/* 42:48 */       return localAnnotation;
/* 43:   */     }
/* 44:   */   }
/* 45:   */   
/* 46:   */   private static class HolderAdapter<T extends PsiElement>
/* 47:   */     extends CommonAnnotationHolder<T>
/* 48:   */   {
/* 49:   */     private final AnnotationHolder a;
/* 50:   */     
/* 51:   */     HolderAdapter(AnnotationHolder paramAnnotationHolder)
/* 52:   */     {
/* 53:56 */       this.a = paramAnnotationHolder;
/* 54:   */     }
/* 55:   */     
/* 56:   */     public Annotation createAnnotation(T paramT, @NotNull HighlightSeverity paramHighlightSeverity, String paramString)
/* 57:   */     {
/* 58:60 */       if (paramHighlightSeverity == null) {
/* 59:60 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder$HolderAdapter", "createAnnotation" }));
/* 60:   */       }
/* 61:60 */       if (paramHighlightSeverity == HighlightSeverity.ERROR) {
/* 62:61 */         return this.a.createErrorAnnotation(paramT, paramString);
/* 63:   */       }
/* 64:62 */       if (paramHighlightSeverity == HighlightSeverity.WARNING) {
/* 65:63 */         return this.a.createWarningAnnotation(paramT, paramString);
/* 66:   */       }
/* 67:64 */       if (paramHighlightSeverity == HighlightSeverity.WEAK_WARNING) {
/* 68:65 */         return this.a.createWeakWarningAnnotation(paramT, paramString);
/* 69:   */       }
/* 70:67 */       return this.a.createInfoAnnotation(paramT, paramString);
/* 71:   */     }
/* 72:   */   }
/* 73:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.model.annotation.CommonAnnotationHolder

 * JD-Core Version:    0.7.0.1

 */